<?php
require('config.php');

        $user_id=$_REQUEST['user_id'];
        $pan=$_REQUEST['pan'];
        $ypwd=$_REQUEST['ypwd'];
        $hpwd=$_REQUEST['hpwd'];
        $sql="select * from `".$oto."_users` where `userId`='".$user_id."' LIMIT 1";
		$result=$db->query($sql);
		while($row=$result->fetch_assoc()){
			$user_info[]=$row;//将取得的所有数据赋值给person_info数组
		}
        if($pan==2)
        {
        	$hpwd=md5($hpwd.$user_info[0]['loginSecret']);
        	$sql="update ".$oto."_users set payPwd='{$hpwd}' where userId='{$user_id}'";
			$result=$db->query($sql);
			if($result)
			{
				$data[0]['pan']=21;
			}
			else
			{
				$data[0]['pan']=22;
			}
        }
        else if($pan==3)
        {
        	$ypwd=md5($ypwd.$user_info[0]['loginSecret']);
        	$hpwd=md5($hpwd.$user_info[0]['loginSecret']);
        	if($ypwd!=$user_info[0]['payPwd'])
        	{
        		$data[0]['pan']=30;
        	}
        	else
        	{
        		$sql="update ".$oto."_users set payPwd='{$hpwd}' where userId='{$user_id}'";
				$result=$db->query($sql);
				if($result)
				{
					$data[0]['pan']=31;
				}
				else
				{
					$data[0]['pan']=32;
				}
        	}
        }
		echo json_encode($data);
?>